#include <iostream>
using namespace std;
int main()
{
    double x1,x2,y1,y2;
    cin>>x1>>y1>>x2>>y2;
    int ans=0;
    if(x1*x2<=0) ans++;
    if(y1*y2<=0) ans++;
    if(ans==2)
    {
        double k=(y1-y2)/(x1-x2);
        if(k*x1==y1) ans--;

    }
    cout<<ans;
    return 0;
}
